package reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
/*有参构造*/
public class reflectDemo3 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException{
        Person person = new Person("1",1);
        System.out.println(person);
        Class<?> aClass = Class.forName("reflect.Person");
        Constructor<?> constructor = aClass.getConstructor(String.class, int.class);
        Object yjp = constructor.newInstance("yjp", 123);
        System.out.println(yjp);



    }
}
